<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>登陆成功</title>
    <script type="text/javascript" src="../../js/jquery-2.1.0.min.js"></script>
</head>
<script>
</script>
<body>
<button onclick="quit()">退出登陆</button>
<h1 th:text="${userName}" id="name"></h1>
<h1>登陆成功</h1>
<h2>登陆时间</h2>
<h2 th:text="${time}"></h2>
<div th:text="${id}" id="uid" style="display: none"></div>
</body>
<script>
    function quit() {
        var name = $("#name").text();
        var id = $("#uid").text();
        console.log(name);
        console.log(id);
        $.ajax({
            url: "/login/quit",
            type: "POST",
            dataType: "json",
            data: {"name":name,"id":id},
            success: function (data) {
                console.log(data);
                alert(data.message);
                window.location.href = "../login/index";
            },
            error: function () {
                alert("服务器出错!");
            },
        });
    }
</script>
</html>